package com.xiaozhaovip.demo.intf.mapper;

import com.xiaozhaovip.demo.intf.entity.YueQiLaiActivityJoiner;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 活动参与人 持久层
 *
 * @author Cauli
 */
@Mapper
public interface YueQiLaiActivityJoinerMapper {
    @Select("select id, JoinerId, ActivityId, Status, AddTime, UpdateTime from yue_activity_joiner where JoinerId = #{id} and ActivityId = #{activityId}")
    YueQiLaiActivityJoiner loadByUserIdAndActivityId(int id, int activityId);

    @Insert("insert yue_activity_joiner (JoinerId, ActivityId, Status, AddTime, UpdateTime) values (#{joinerId}, #{activityId}, #{status}, now(), now())")
    int insert(YueQiLaiActivityJoiner joiner);

    @Update("update yue_activity_joiner set Status = #{status}, UpdateTime = now() where JoinerId = #{joinerId} and ActivityId = #{activityId}")
    int updateJoinerStatusById(int joinerId, int activityId, int status);
}
